package com.opensso.sdk.client;

/**
 * api枚举
 * Created by lixin on 2017/6/7.
 */
public enum UrlEnum {
    Verify_Token_Url("/verify/verifyToken"),/*sso系统的token验证api*/
    RefreshToken_Timeout_Url("/token/refresh/timeout"),/*sso系统的刷新token过期时间api*/
    RefreshToken_Url("/token/refresh"),/*sso系统的刷新token过期时间api*/
    Invalidate_Url("/token/invalidate"),/*sso系统注销账号api*/;

    public String url;

    UrlEnum(String url) {
        this.url = url;
    }

    /**
     * 生成请求api
     *
     * @param host    主机地址 默认可以传递ip或者域名均可
     * @param urlEnum api枚举
     * @return api
     */
    public static String genUrl(String host, UrlEnum urlEnum) {
        if (host.contains("http") || host.contains("https")) {
            return host + urlEnum.url;
        } else {
            return "http://" + host + urlEnum.url;
        }
    }

}
